<div class="index">
	
	<?php if(count($ps)>0) {?>
	<h3>
	<?php echo 'Công trình: '.$ct['Ctrinh']['tenctrinh']; ?>
	</h3>
	<h5>
	<?php echo $bc['Bc']['tenbaocao']; ?>
	</h5>

	<h3>
	<?php __('Danh sách các phiếu');?>
	</h3>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('STT','id');?></th>
	
			<th><?php echo $this->Paginator->sort('Tên phiếu','tenphieu');?></th>
			<th><?php echo $this->Paginator->sort('Thời gian lập','ngaylap');?></th>
			
			<th class="actions"><?php __('Chọn chức năng');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($ps as $p):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i; ?>&nbsp;</td>
		
		<td><?php echo $p['P']['tenphieu']; ?>&nbsp;</td>
		<td><?php echo $p['P']['ngaylap']; ?>&nbsp;</td>
		
		<td class="actions">
			<?php echo $this->Html->link(__('Nhập liệu', true), array('action' => 'nhaplieu', $p['P']['id'])); ?>
			<?php echo $this->Html->link(__('Xem KQ', true), array('action' => 'xuat', $p['P']['id'])); ?>
			<?php echo $this->Html->link(__('Sửa mẫu', true), array('action' => 'taomau',$p['P']['ctrinh_id'],$p['P']['maup_id'], $p['P']['id'])); ?>
			<?php echo $this->Html->link(__('Xuất báo cáo', true), array('action' => 'xuatbc', $p['Ctrinh']['id'],$p['P']['id'])); 

			?>
			<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete', $p['P']['id']), null, sprintf(__('Bạn có chắc muốn xóa phiếu # %s?', true), $p['P']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<!-- <p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p> -->

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Lùi lại', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Tiếp theo', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>

	<?php }
	else{
		echo 'Chưa có phiếu nào cho công trình này';
	}?>
<div class="actions">
	<!--<h3><?php __('Actions'); ?></h3>-->
	<ul>
		<li><?php echo $this->Html->link(__('Thêm phiếu', true), array('action' => 'khoitao',$idct)); ?></li>
		<li><?php echo $this->Html->link(__('DS các báo cáo', true), array('controller'=>'bcs','action' => 'index',$idct)); ?></li>
		<li><?php echo $this->Html->link(__('DS công trình', true), array('controller' => 'ctrinhs', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Tạo Công trình mới', true), array('controller' => 'ctrinhs', 'action' => 'add')); ?> </li>
		</ul>
</div>
</div>
